package factorialSum;

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner reader=new Scanner(System.in);
        long n=reader.nextLong();
        long sum=0;
        for(int i=1;i<=n;i++){
            sum+=Factorial.getFactorial(i,1);
        }
        System.out.println(sum);
    }
}
